n = int(input())
arr = list(map(int, input().split()))
mx1 = arr.index(max(arr))
x = max(arr)
arr[mx1] = 0
mx2 = arr.index(max(arr))
arr[mx1] = x
s = sum(arr)
ans = []
for i in range(n):
if i == mx1:
if s - arr[mx1] - arr[mx2] == arr[mx2]:
ans.append(i + 1)
else:
if s - arr[i] - arr[mx1] == arr[mx1]:
ans.append(i + 1)
print(len(ans))
print(*ans)
#include<iostream>
#include<string>
#include<algorithm>
#include<iomanip>
#include<math.h>
#include<utility>
#include <vector>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
long long n, sum = 0;
cin >> n;
vector<long long > a(n), f(n), arr(n);
for (int y = 0; y < n; ++y)
{
cin >> a[y];
f[y] = a[y];
sum += a[y];
}
long long b,mm=0;
bool k = 0;
sort(f.begin(), f.end());
for (int y = 0; y < n; ++y)
{
long long h = sum - a[y];
b = h / 2;
if (h % 2 == 0)
{
int count = upper_bound(f.begin(), f.end(), b) - lower_bound(f.begin(), f.end(), b);
if ((binary_search(f.begin(), f.end(), b) && (b != a[y] ||count>=2)))
{
a[y] = 0;
k = 1;
arr[mm++] = y+1;
}
}
}
if (k)
{
cout << mm << "\n";
for (int i = 0; i < mm; ++i)
{
cout << arr[i] << " ";
}
}
else
{
sum = 0;
cout << sum << "\n";
}
}
653A - Bear and Three Balls | 794A - Bank Robbery |
157A - Game Outcome | 3B - Lorry |
1392A - Omkar and Password | 489A - SwapSort |
932A - Palindromic Supersequence | 433A - Kitahara Haruki's Gift |
672A - Summer Camp | 1277A - Happy Birthday Polycarp |
577A - Multiplication Table | 817C - Really Big Numbers |
1355A - Sequence with Digits | 977B - Two-gram |
993A - Two Squares | 1659D - Reverse Sort Sum |
1659A - Red Versus Blue | 1659B - Bit Flipping |
1480B - The Great Hero | 1519B - The Cake Is a Lie |
1659C - Line Empire | 515A - Drazil and Date |
1084B - Kvass and the Fair Nut | 1101A - Minimum Integer |
985D - Sand Fortress | 1279A - New Year Garland |
1279B - Verse For Santa | 202A - LLPS |
978A - Remove Duplicates | 1304A - Two Rabbits |